import HYRequest from '@/service/request'
import { BASE_URL, TIME_OUT } from '@/service/request/config'

const hyRequest = new HYRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT
})

const twtRequest = new HYRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  interceptors: {
    responseInterceptors: (res: any) => {
      const { captchacode, requestid } = res.headers
      const loginId = {
        captchacode,
        requestid
      }
      sessionStorage.setItem('loginId', JSON.stringify(loginId))
      return res
    }
  }
})

export { hyRequest, twtRequest }
